package cn.kgc.service.system;

import cn.kgc.dao.system.DictDao;
import cn.kgc.pojo.Dict;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictServiceImpl implements DictService {
    @Autowired
    private DictDao dictDao;

    @Override
    public Integer addDict(Dict dict) {
        if (dict != null) {
            return dictDao.addDict(dict);
        }
        return 0;
    }

    @Override
    public Integer updateDict(Dict dict) {
        if(dict != null){
            return dictDao.updateDict(dict);
        }
        return 0;
    }

    @Override
    public List<Dict> selectDict() {
        return dictDao.selectDict();
    }

    @Override
    public Integer deleteDict(Integer id) {
        if(id != null){
            return dictDao.deleteDict(id);
        }
        return 0;
    }

    @Override
    public Dict selectDictById(Integer id) {
        if (id != null) {
            return dictDao.selectDictById(id);
        }
        return null;
    }

    @Override
    public List<Dict> selectDictByTypeId(Integer typeId) {
        if (typeId != null) {
            return dictDao.selectDictByTypeId(typeId);
        }
        return null;
    }

}
